import { PureComponent } from 'react';
import { Swiper,Image,Loading} from 'react-vant';
import './index.less'
class HomeSwiper extends PureComponent {
    render() {
        console.log(this.props)
        return (
            <div className='HomeSwiper'>
                {
                    this.props.bannerList.length !== 0 && <Swiper autoplay={3000}>
                        {
                            this.props.bannerList.map((item) => {
                                return (
                                    <Swiper.Item key={item.id}>
                                        <div>
                                        <Image width='100%' height='150px' src={item.pic} lazyload={true} loadingIcon={<Loading type='spinner' />}/>
                                        </div>
                                    </Swiper.Item>
                                )
                            })
                        }
                    </Swiper>
                }
                {
                    this.props.bannerList.length === 0 &&   <Image width='100%' height='150px' />
                }
            </div >
        )
    }
}
export default HomeSwiper